Draws this instance in the colors of a palette instead of its sprite’s own colors. Only the instance that calls it changes: another copy of the same object keeps its colors. sprite_palette(nothing) puts the sprite’s own colors back.
Works differently on Game Boy - Each color of the palette becomes the closest of the 4 shades, and only one swapped set of shades can show on sprites at a time: sprites that wear another set keep their own shades.
Works differently on Game Boy Color - The Game Boy Color has 8 palettes for sprites and 8 for the picture, each with 4 colors, and the sprites showing at the same time share the 8: when they run out, the extra ones keep their own colors.
On other consoles this differs: see Side by side and How the consoles differ.
sprite_palette(palette)| Name | Type |
|---|---|
palette | palette |
Nothing.
Draws this instance in the colors of a palette instead of its sprite's own colors. Only the instance that calls it changes. Another copy of the same object keeps its colors, because the palette belongs to the instance that asked for it.
sprite_palette(nothing) takes the palette off again and the sprite goes back to its own colors.
The palette stays on the instance until you change it, and it follows the instance when you change sprite: switch to a different picture and the new one is drawn in the same colors. It works for the automatic drawing and for draw_self. A picture you draw with draw_sprite is a picture of its own and is drawn in its own colors.
The palette has to have 16 colors, because a sprite is drawn with 16. A palette with 256 colors is for the zoomable background, and the build tells you if you give one here.
// Create event of one enemy out of a crowd
sprite_palette(pal_doc_gold);This enemy is gold. Every other copy of the object is not.
// Step event: a hit makes the enemy flash back to its own colors
sprite_palette(nothing);The console has 16 sprite palettes and every different palette on the screen at once takes one, your sprites' own colors included. Two instances with the same palette share a slot, so a whole crowd in one gold palette costs one. If all 16 are taken a development build stops. A release build leaves that instance in its sprite's own colors. See Palettes.
A sprite keeps color numbers and a palette says which color each number is, so one picture can be drawn in as many colors as you have palettes. The palette has to have 16 colors (the 4-bit kind, which is what a sprite is). It stays on the instance until you change it, and it follows the instance when you change `sprite`, so a new picture is drawn in the same colors. It covers default drawing and draw_self(); a picture drawn with draw_sprite() or draw_sprite_scaled() has its own colors. The console has 16 sprite palettes and every DIFFERENT palette showing at once uses one of them, the sprites’ own colors included: two instances with the same palette share one, an instance with a different one takes another. When all 16 are taken a development build stops with a message that says so; a release build leaves that instance in its sprite’s own colors. A palette with 256 colors is refused when you build, and a palette is built into the game only when some code or setting uses it.